package com.vf.admin.client.dao;

import com.vf.admin.common.db.BaseDao;
import com.vf.admin.miaodong.entity.AppDressuprecord;
import com.vf.admin.miaodong.entity.AppDynamic;
import com.vf.admin.utils.StringEx;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;
/**
 * 坐骑、头饰购买记录
 */
@Repository
public class AppDressuprecordDao extends BaseDao<AppDressuprecord> {

    /**
     * 详情
     */
    public AppDressuprecord get(Integer id) {
        if (id==null || id<=0) {
            return null;
        }
        List<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder("select * from app_dressuprecord where id = ?  ");
        paramList.add(id);
        String sql = sbStr.toString();
        return this.queryObj(sql, paramList, AppDressuprecord.class);
    }

    /**
     * 添加/修改
     */
    public void save(AppDressuprecord haoYou) {
        if (haoYou!=null && haoYou.getId() != null && haoYou.getId() > 0) {
            this.update(haoYou);
        } else {
            haoYou.setId(this.add(haoYou));
        }
    }

    /**
     * 删除
     */
    public void del(Integer id) {
        if (id==null || id <= 0) {
            return;
        }
        String sql = "delete  from app_dressuprecord where id = ?";
        ArrayList<Object> paramList = new ArrayList<Object>();
        paramList.add(id);
        this.del(sql, paramList);
    }

}
